﻿@model  PagedList.IPagedList<LetLord.Models.ResidentialProperty>

@foreach (var result in Model)
{
    <div class="result-container">
        <div class="span3">
            @if (result.PropertyPhotos.Count == 0)
            {
                <img class=" img-rounded" src="~/Images/noImage.jpg" />
            }
            else
            {
                <img class=" img-rounded" src="@Url.Action("GetPhotos", "Landlords", new { id = result.PropertyPhotos.First().ImageId })" alt="" />
            }
        </div>
        <div class="span2 summary">
            <div class="address">
                @result.Address.TownCity<br />@result.Address.County
            </div>
            <div>
                @result.NumberOfBedrooms Bedrooms
            </div>
            <div>
                @result.NumberOfBathrooms Bathrooms
            </div>
        </div>
        <div class="span4 description">
            @result.Description
        </div>
        <div class="span3">
            <h4 class="price">
                €@result.MonthlyRate.ToString("0.##") Monthly
            </h4>
            <button class="btn btn-primary btn-block show-modal" data-id="@result.ResidentialPropertyId">More info</button>
        </div>
    </div>
}
<div class="paging">
    <div class="span12">
        Page @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber)
        of @Model.PageCount

        @if (Model.HasPreviousPage)
        {
            @Ajax.ActionLink("<<", "GetAllProperties", new { page = 1 }, new AjaxOptions { UpdateTargetId = "quick-property-search-results" }, new { @class = "pagination-left" })
            @Html.Raw(" ");
            @Ajax.ActionLink("< Prev", "GetAllProperties", new { page = Model.PageNumber - 1 }, new AjaxOptions { UpdateTargetId = "quick-property-search-results" }, new { @class = "pagination-left" })
        }
        else
        {
            @:<<
            @Html.Raw(" ");
            @: < Prev
            }
        @if (Model.HasNextPage)
        {
            @Ajax.ActionLink("Next >", "GetAllProperties", new { page = Model.PageNumber + 1 }, new AjaxOptions { UpdateTargetId = "quick-property-search-results" }, new { @class = "pagination-right" })
            @Html.Raw(" ");
            @Ajax.ActionLink(">>", "GetAllProperties", new { page = Model.PageCount }, new AjaxOptions { UpdateTargetId = "quick-property-search-results" }, new { @class = "pagination-right" })
        }
        else
        {
            @:Next >
            @Html.Raw(" ")
            @:>>
            }
    </div>

</div>

<div class="modal hide fade in" id="modal-view-property-from-get-all" data-url="ResidentialProperties/ViewProperty">
    <div id="view-property-from-get-all-container"></div>
</div>

